package com.hui.mapper;

import com.hui.entity.WareHouse;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @Description
 * @date 2023/2/11 8:48
 */
public class WareHouseMapper implements RowMapper<WareHouse> {

    @Override
    public WareHouse rowToEntity(ResultSet rs) {
        WareHouse wareHouse = null;

        try {
            int warehouseId = rs.getInt("warehouseId");
            String warehouseName = rs.getString("warehouseName");
            String warehouseAddr = rs.getString("warehouseAddr");
            String warehouseDesc = rs.getString("warehouseDesc");
            String status = rs.getString("status");

            wareHouse = new WareHouse(warehouseId, warehouseName, warehouseAddr, warehouseDesc, status);
        } catch (SQLException e) {
            e.printStackTrace();
        }

        return wareHouse;
    }
}
